<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 300px;
            height: 100px;
            background-color: red;
              transition: all 1s ease;
        }
        .show{
            opacity: 1;
            width: 300px;
            height: 100px;
            background-color: red;
        }
        .hide{
            opacity: 0;
            width: 0px;
            height: 0px;
            background-color: aqua;
        }
        .active{
            transition: all 1s ease;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="button" value="打开|关闭" @click="isshow=!isshow">
            <transition 
            enter-from-class="hide"
            leave-to-class="hide">
            <div class="box" v-show="isshow"></div>
            </transition>

    </div>
    <script type="module">
        import { createApp } from "../assets/vue3/vue.esm-browser.js";
        createApp({
            data() {
                return {
                    isshow:false
                }
            }
        }).mount("#app");
    </script>
</body>
</html>